
var gemCounter = 0
var switchCounter = 0

moveForward()
moveForward()

for _ in 1...15 {
    if isOnGem {
        collectGem()
        gemCounter += 1
    }
    
    if isOnClosedSwitch && switchCounter != gemCounter {
        toggleSwitch()
        switchCounter += 1
    }
    
    moveForward()
    
    if isBlocked {
        turnRight()
    }
}
